package swust.fc;

import swust.fc.config.AppConfig;
import swust.fc.context.ApplicationContext;
import swust.fc.service.UserService;

/**
 * 主应用类
 * 演示如何使用自定义Spring容器
 */
public class MainApp {
    public static void main(String[] args) throws Exception {
        // 创建容器，传入配置类
        ApplicationContext context = new ApplicationContext(AppConfig.class);

        // 获取Bean并使用
        UserService userService = context.getBean(UserService.class);
        System.out.println("User: " + userService.getUserName());

        String appName = context.getBean(String.class);
        System.out.println("App: " + appName);
    }
}
